import ReactQuill from "react-quill";
import "react-quill/dist/quill.snow.css";

function RichTextEditor(props: any) {

  console.log(888888, props);

  //const [editorContent, setEditorContent] = useState("");

  const handleEditorChange = (content: any, delta: any, source: any, editor: any) => {
    // console.log(content);
    //setEditorContent(content);
    props.getcontent(content)
    console.log(delta, source, editor);

  };

  return (
    <div className="rich-text-editor">

      <ReactQuill
        value={props.txt}
        onChange={handleEditorChange}
        modules={{
          toolbar: [
            [{ header: [1, 2, false] }],
            ["bold", "italic", "underline", "strike", "blockquote"],
            [
              { list: "ordered" },
              { list: "bullet" },
              { indent: "-1" },
              { indent: "+1" },
            ],
            ["link", "image"],
            ["clean"],
          ],
        }}
        placeholder="请输入内容"
      />
    </div>
  );
}

export default RichTextEditor;